use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('posts', function (Blueprint $table) {
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
$table->foreignId('user_id')
->constrained("users") <- // You don't need to specify table if it matched laravel naming conventions.
->onUpdate('cascade')
->onDelete('cascade');